package services.interfaces;

import java.util.ArrayList;
import java.util.List;

public class CompositeTaxAdapter implements ITaxCalculatorAdapter{
	
	//Collection of child groups
	private List<ITaxCalculatorAdapter> adapters = new ArrayList<ITaxCalculatorAdapter>();
	
	public void add(ITaxCalculatorAdapter taxInterface){
		
		adapters.add(taxInterface);
	}
	
	@Override
	public double getTaxes(double baseTotal) {
		
		double total = baseTotal;
		
		for (ITaxCalculatorAdapter adapter: adapters)
		{
			total = adapter.getTaxes(total);
		}
		return total;
	}

}
